
<%@ page import="org.gtesoreria.Consumo" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'consumo.label', default: 'Consumo')}" />
        <title><g:message code="default.list.label" args="[entityName]" /></title>
    </head>
    <body>
        <div class="nav" style="display:none">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"> <g:link class="proveedores" action="list" controller="proveedor">Proveedores</g:link></span>
            <span class="menuButton"><g:link class="proveedorBoton" controller="proveedor" action="show" id="${proveedorInstance?.id}">${proveedorInstance?.nombre}</g:link></span>
        </div>
        <div class="body">
            <h1>Consumos en ${proveedorInstance?.nombre}</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <div style="margin-top:10px;margin-bottom:10px;border:1px solid #999; padding:5px">
            	<g:form action="list">
            		<g:hiddenField name="proveedorId" value="${proveedorInstance?.id}"></g:hiddenField>
            		<table style="border:0px">
            		<tr>
            		<td style="padding-top:8px">Desde:</td>
            		<td><g:datePicker name="from" precision="month"></g:datePicker></td>
            		</tr>
            		<tr>
            		<td style="padding-top:8px">Hasta:</td>
            		<td><g:datePicker name="to" precision="month"></g:datePicker></td>
            		</tr>
            		<tr>
            		<td>&nbsp</td>
            		<td style="text-align:right">
            			<g:submitButton name="list" id="buscar" value="${message(code: 'default.button.buscar.label', default: 'Buscar')}" />
            		</td>
            		</tr>
            		</table>
            	</g:form>
            </div>
            <div class="list">
                <table>
                    <thead>
                        <tr>
                        
                            <th>${message(code: 'consumo.consumo.label', default: 'Consumo')} </th>
                        
                            <th><g:message code="consumo.afiliado.label" default="Afiliado" /></th>
                        
                            <th>${message(code: 'consumo.estado.label', default: 'Estado')} </th>
                        
                            <th>${message(code: 'consumo.periodo.label', default: 'Periodo')} </th>
                        
                            <th>${message(code: 'consumo.monto.label', default: 'Monto')} </th>
                            
                            <th style="width:8em">${message(code: 'consumo.monto.label', default: 'MontoDescuento')} </th>
                            
                            <th style="width:8em">${message(code: 'consumo.monto.label', default: 'MontoPagoProveedor')} </th>
                            
                            <th>${message(code: 'consumo.cuotas.label', default: 'Cuotas')} </th>
                        
                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${consumoInstanceList}" status="i" var="consumoInstance">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                        
                            <td><g:link action="show" id="${consumoInstance.id}">${fieldValue(bean: consumoInstance, field: "id")}</g:link></td>
                        
                            <td>${fieldValue(bean: consumoInstance, field: "afiliado.apellidoNombre")}</td>
                        
                            <td>${fieldValue(bean: consumoInstance, field: "estado")}</td>
                        
                            <td><g:formatDate date="${consumoInstance.fecha}" format="MM-yyyy"/></td>
                        
                            <td style="text-align:right"><g:formatNumber number="${consumoInstance?.monto}" type="number" minFractionDigits="2" maxFractionDigits ="2" roundingMode="HALF_UP" /></td>
                            
                            <td style="text-align:right"><g:formatNumber number="${consumoInstance?.montoDescuento()}" type="number" minFractionDigits="2" maxFractionDigits ="2" roundingMode="HALF_UP" /></td>
                            
                            <td style="text-align:right"><g:formatNumber number="${consumoInstance?.montoProveedor()}" type="number" minFractionDigits="2" maxFractionDigits ="2" roundingMode="HALF_UP" /></td>
                            
                            <td>${fieldValue(bean: consumoInstance, field: "nroCuota")} / ${fieldValue(bean: consumoInstance, field: "cantCuotas")}</td>
                        
                        </tr>
                    </g:each>
                    <tr>
                    	<td colspan="3">
                    	&nbsp;
                    	</td>
                    	<td>TOTAL:</td>
                    	<td>${total}</td>
                    	<td>&nbsp;</td>
                    	<td>&nbsp;</td>
                    	<td>&nbsp;</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="paginateButtons">
                <g:paginate total="${consumoInstanceTotal}" />
            </div>
        </div>
                <div class="main-subcontent">

        <!-- Subcontent unit -->
	        <div class="subcontent-unit-border-blue">
	          <div class="round-border-topleft"></div><div class="round-border-topright"></div>
	          <h1 class="blue">Consumos en Proveedor</h1>
	          <p style="text-align:left;font-style:normal">Defina periodo dentro del cual desea ver los consumos realizados en el proveedor seleccionado</p>
	          <p style="text-align:left;font-style:normal">Como resultado vera los consumos realizados detallando el monto, el monto a descontar al afiliado</p>
	        </div>
	        
        </div>
    </body>
</html>
